﻿// See https://aka.ms/new-console-template for more information
using SnailInfo.ConvertExtension;
using SnailInfo.ConvertExtension.Enums;
using System.Security.Cryptography;
using System.Text;


Console.WriteLine("Hello, World!");
  long TicksPerMicrosecond = 10;
  long TicksPerMillisecond = TicksPerMicrosecond * 1000;
 long TicksPerSecond = TicksPerMillisecond * 1000;
var currDate = DateTime.Now;
Console.WriteLine(currDate.ToString("yyyy-MM-dd HH:mm:ss.fff"));

var bb = currDate.ToUniversalTime();
Console.WriteLine(bb.ToString("yyyy-MM-dd HH:mm:ss.fff"));

var cc = currDate.ToTimeStamp();
Console.WriteLine(cc.ToString());


long ticks = currDate.ToUniversalTime().Ticks;
var unixEpochTicks = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;
var result = (ticks - unixEpochTicks) / TicksPerSecond;
Console.WriteLine(result.ToString());
var offset = new DateTimeOffset(currDate.ToUniversalTime());


Console.WriteLine(offset.ToUnixTimeSeconds());

Console.WriteLine("check md5");
string text = "iFeihang";

Console.WriteLine(text.ToHashString());
using var md5 = MD5.Create();
byte[] array = md5.ComputeHash(Encoding.UTF8.GetBytes(text));
Console.WriteLine(Convert.ToHexString(array     ));

Console.WriteLine($"SHA 256-->{text.ToSHA256String()}");
Console.WriteLine(RandomType.Char62.Generate(6));
Console.WriteLine("============To Decimal=================");
decimal d = -1.23M;
Console.WriteLine(d.ToDecimal(1));

Console.WriteLine("============To Decimal=================");